﻿using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
using System.Linq;
using System.Reflection;
using NPOI.HSSF.UserModel;
using NPOI.SS.UserModel;
using NPOI.XSSF.UserModel;

namespace DBD.Common.NPOI
{
    public class ExcelHandle
    {
        #region # 属性

        /// <summary>
        /// 完整路径
        /// </summary>
        public string FullPath { get; }

        /// <summary>
        /// 路径
        /// </summary>
        public string DirectoryName { get; }

        /// <summary>
        /// 文件名(带扩展名)
        /// </summary>
        public string FileName { get; }

        /// <summary>
        /// 文件名（无扩展名）
        /// </summary>
        public string FileNameWithoutExtension { get; }

        /// <summary>
        /// 扩展名
        /// </summary>
        public string Extension { get; }

        #endregion


        /// <summary>
        /// 构造器
        /// </summary>
        /// <param name="fullPath">完整路径</param>
        public ExcelHandle(string fullPath)
        {
            this.FullPath = fullPath;   //C:\dir1\dir2\foo.txt
            this.DirectoryName = Path.GetDirectoryName(fullPath);   //C:\dir1\dir2
            this.FileName = Path.GetFileName(fullPath); //foo.txt
            this.FileNameWithoutExtension = Path.GetFileNameWithoutExtension(fullPath); //foo
            this.Extension = Path.GetExtension(fullPath);   //.txt
            //this.PathRoot = Path.GetPathRoot(fullPath);   //C:\
        }

      

    }
}
